import request from '@/utils/request'

// 社交绑定，使用 code 授权码
export const socialBind = (type, code, state) => {
  return request({
    url: '/system/social-user/bind',
    method: 'POST',
    data: {
      type,
      code,
      state,
    },
  })
}

// 取消社交绑定
export const socialUnbind = (type, openid) => {
  return request({
    url: '/system/social-user/unbind',
    method: 'DELETE',
    data: {
      type,
      openid,
    },
  })
}

// 社交授权的跳转
export const socialAuthRedirect = (type, redirectUri) => {
  return request({
    url: `/system/auth/social-auth-redirect?type=${type}&redirectUri=${redirectUri}`,
    method: 'GET',
  })
}
